package xju_3_4.entity;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class School {
    @Value("1")
    private Integer id;
    // 默认根据类型注入
    @Autowired
    @Qualifier("stu")
    // 默认更具名称注入
//    @Resource
    private Student student;

    public School() {
    }

    public School(Integer id, Student student) {
        this.id = id;
        this.student = student;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }

    @Override
    public String toString() {
        return "School{" +
                "id=" + id +
                ", student=" + student +
                '}';
    }
}
